<?php
header("Pragma: public");
header("Expires: 0");
header("Accept-Ranges: bytes");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type:text/xml");
header('Content-Disposition: attachment; filename=xmltofisdeleteapp.xml');
header("Content-Transfer-Encoding: binary");

$auth_arr = array( 
					'Login' =>'tkachenkopv@kursksmu.net',
					'Pass'=> 'OqZvVNZ'
			); //
$package_arr = array('Applications' => array('Application' => array()));

	foreach ($abiturients as $abiturient):

		/***********************************************************
		 * формирование элемента
		 **********************************************************/ 
		$newdata =  array(
							'ApplicationNumber' => $abiturient['Abiturient']['id'].'-2013',
							'RegistrationDate' => date('Y-m-d\TH:i:s', strtotime( $abiturient['Abiturient']['created'])), // дата регистрации заявления

					);
		array_push($package_arr['Applications']['Application'], $newdata);
	endforeach;
	//debug($newdata);
	//debug($package_arr);
	//die();
$xmlArray = array('Root' => array('AuthData' => array(), 'PackageData' => array()));
$xmlArray['Root']['AuthData'] = $auth_arr;
$xmlArray['Root']['DataForDelete'] = $package_arr;
//debug($xmlArray);
$resultxml = Xml::build($xmlArray, array('return' => 'simplexml'));

echo $resultxml->asXML();
?>

